﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using VisualWip.Core;

namespace CoreTests
{
    [TestClass]
    public class WorkInProgressLimitCalculatorTests
    {
 
        private TestContext _testContextInstance;

        public TestContext TestContext
        {
            get
            {
                return _testContextInstance;
            }
            set
            {
                _testContextInstance = value;
            }
        }


        [TestMethod]
        public void DualState()
        {
            Assert.AreEqual(new Tuple<int, int>(4, 1), WorkInProgressLimitCalculator.DualQueries(4, 0, 0), "WIPL:{0} F:{1} S:{2}", 4, 0, 0);
            Assert.AreEqual(new Tuple<int, int>(0, 4), WorkInProgressLimitCalculator.DualQueries(4, 0, 4), "WIPL:{0} F:{1} S:{2}", 4, 0, 4);
            Assert.AreEqual(new Tuple<int, int>(3, 2), WorkInProgressLimitCalculator.DualQueries(4, 4, 1), "WIPL:{0} F:{1} S:{2}", 4, 4, 1);
            Assert.AreEqual(new Tuple<int, int>(2, 3), WorkInProgressLimitCalculator.DualQueries(4, 4, 2), "WIPL:{0} F:{1} S:{2}", 4, 4, 2);
            Assert.AreEqual(new Tuple<int, int>(1, 4), WorkInProgressLimitCalculator.DualQueries(4, 4, 3), "WIPL:{0} F:{1} S:{2}", 4, 4, 3);
            Assert.AreEqual(new Tuple<int, int>(0, 4), WorkInProgressLimitCalculator.DualQueries(4, 4, 4), "WIPL:{0} F:{1} S:{2}", 4, 4, 4);
            Assert.AreEqual(new Tuple<int, int>(4, 1), WorkInProgressLimitCalculator.DualQueries(4, 4, 0), "WIPL:{0} F:{1} S:{2}", 4, 4, 0);
            Assert.AreEqual(new Tuple<int, int>(4, 1), WorkInProgressLimitCalculator.DualQueries(4, 3, 0), "WIPL:{0} F:{1} S:{2}", 4, 3, 0);
            Assert.AreEqual(new Tuple<int, int>(4, 1), WorkInProgressLimitCalculator.DualQueries(4, 0, 0), "WIPL:{0} F:{1} S:{2}", 4, 0, 0);
                                                                                     
            Assert.AreEqual(new Tuple<int, int>(0, 1), WorkInProgressLimitCalculator.DualQueries(1, 1, 2), "WIPL:{0} F:{1} S:{2}", 1, 1, 2);
            Assert.AreEqual(new Tuple<int, int>(1, 3), WorkInProgressLimitCalculator.DualQueries(3, 1, 2), "WIPL:{0} F:{1} S:{2}", 3, 1, 2);
        }
    }
}
